Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadToolTipManager=function(a){Telerik.Web.UI.RadToolTipManager.initializeBase(this,[a]);
this._targetControls=null;
this._isToolTipFactory=false;
this._loadOnDemand=false;
this._toolTipZoneID=null;
this._autoTooltipify=false;
this._updatePanelUniqueId="";
this._updatePanelParent=null;
this._tooltips=[];
this._idCounter=100;
this._webServiceSettings=null;
this._cssClass=null;
};
Telerik.Web.UI.RadToolTipManager.prototype={initialize:function(d){this.set_zIndex($telerik.getCurrentStyle(this.get_element(),"zIndex"));
var c=this.get_updatePanel();
if(c){this._updatePanelParent=c.parentNode;
}var b=this.get_visibleOnPageLoad();
this.set_visibleOnPageLoad(false);
var a=this.get_toolTipZoneID();
this.tooltipify(a?$get(a):document,a?this._isDescendant:null);
if(b&&this._tooltips[0]){this._tooltips[0].show();
}window.setTimeout(Function.createDelegate(this,function(){this._trackPageUpdates();
}),0);
},get_updatePanel:function(){return $get(this._getUpdatePanelID());
},dispose:function(){this._moveUpdatePanel();
this._disposeToolTips();
if(this._pageLoadedHandler){var a=Sys.WebForms.PageRequestManager.getInstance();
a.remove_pageLoaded(this._pageLoadedHandler);
this._pageLoadedHandler=null;
}this._updatePanelParent=null;
Telerik.Web.UI.RadToolTipManager.callBaseMethod(this,"dispose");
},_disposeToolTips:function(){for(var b=0;
b<this._tooltips.length;
b++){var a=this._tooltips[b];
a.dispose();
}this._tooltips=null;
},_isDescendant:function(a,b){return $telerik.isDescendant(a,b);
},_trackPageUpdates:function(){if(Sys.WebForms){this._pageLoadedHandler=Function.createDelegate(this,function(b,c){var e=c.get_panelsUpdated();
if(!e){return;
}for(var d=0;
d<e.length;
d++){if(e[d].id==this._getUpdatePanelID()){continue;
}this.tooltipify(e[d],this._isDescendant);
}});
var a=Sys.WebForms.PageRequestManager.getInstance();
a.add_pageLoaded(this._pageLoadedHandler);
}},get_toolTips:function(){return this._tooltips;
},get_tooltips:function(){return this.get_toolTips();
},getToolTipByElement:function(c){if(!c){return null;
}var b=this.get_tooltips();
try{for(var a=0;
a<b.length;
a++){if(b[a].get_targetControl()==c){return b[a];
}}}catch(d){}return null;
},clearCloneCache:function(){this.__clonedProperties__=null;
},createToolTip:function(b,c,e){if(!b){alert("clone error: No target element specified");
return;
}var a=this.clone(this._getUniqueToolTipID());
a._manualCloseButtonText=this._manualCloseButtonText;
a.set_modal(a.isModal());
a._cssClass=this._cssClass;
var d=b.getAttribute("id");
if(d){a.set_targetControlID(d);
}else{a.set_targetControl(b);
}this._tooltips[this._tooltips.length]=a;
if(c&&c!=b.getAttribute("id")){a.set_serverTargetControlID(c);
}if(e){a.set_serverValue(e);
}if(this._loadOnDemand){this._initializeAjaxToolTip(a);
}else{if(this._webServiceSettings){this._initializeWebServiceToolTip(a);
}}return a;
},tooltipify:function(j,h){if(!j){j=document;
}if(!h){h=function(i,k){return true;
};
}var b=this.get_targetControls();
if(b.length>0){var f=b.length;
for(var a=0;
a<f;
a++){var d=b[a];
var e=$get(d[0]);
if(e&&h(j,e)){this.createToolTip(e,d[1],d[2]);
}}}else{if(!this.get_autoTooltipify()){return;
}var b=j.getElementsByTagName("*");
var f=b.length;
for(var a=0;
a<f;
a++){var e=b[a];
var g=e.getAttribute("title");
var c=e.getAttribute("alt");
if(g||c){this.createToolTip(e);
}}}},_initializeWebServiceLoader:function(){this._webServiceLoader=new Telerik.Web.UI.WebServiceLoader(this.get_webServiceSettings());
this._webServiceLoader.add_loadingError(Function.createDelegate(this,this._onWebServiceError));
this._webServiceLoader.add_loadingSuccess(Function.createDelegate(this,this._onWebServiceResponse));
},_onWebServiceError:function(a,b){this._onError(b.get_message());
},_onWebServiceResponse:function(a,d){var c=d.get_data();
var b=document.createElement("DIV");
if(this._currentServicedToolTip){this._currentServicedToolTip.set_contentElement(b);
b.innerHTML=c;
}this.raiseEvent("requestEnd");
},_initializeWebServiceToolTip:function(a){a.add_beforeShow(Function.createDelegate(this,function(b,c){if(!this._webServiceLoader){this._initializeWebServiceLoader();
}var d={TargetControlID:a.get_targetControlID(),Value:a.get_serverValue()};
this._currentServicedToolTip=b;
this._webServiceLoader.loadData({context:d});
b.set_content("");
b.showLoadingMessage(true);
}));
},_initializeAjaxToolTip:function(a){a.add_beforeShow(Function.createDelegate(this,function(b,c){this._doLoadOnDemand(b);
}));
a.add_hide(Function.createDelegate(this,function(b,c){var e=this.get_updatePanel();
var f=b.get_popupElement();
var d=$telerik.isDescendant(f,e);
if(d){this._moveUpdatePanel();
}}));
},_doLoadOnDemand:function(c){var b=this._getDefaultParent();
var d=this._moveUpdatePanel(b,true);
c.showLoadingMessage(true);
var e=Sys.WebForms.PageRequestManager.getInstance();
var a=Function.createDelegate(this,function(g,h){c.set_contentElement(d);
e.remove_endRequest(a);
if(h.get_error()){h.set_errorHandled(true);
this._onError(h.get_error().message);
return;
}this.raiseEvent("requestEnd");
});
e.add_endRequest(a);
var f=c.get_serverTargetControlID();
if(!f){f=c.get_targetControlID();
}this._ajaxControlID=f;
this._ajaxValue=c.get_serverValue();
this.updateClientState();
__doPostBack(this._updatePanelUniqueId);
this._ajaxControlID=null;
this._ajaxValue=null;
},_onError:function(b){if(!b){b="No error data available";
}var a=new Telerik.Web.UI.RadToolTipManagerErrorEventArgs(b);
this.raiseEvent("responseError",a);
if(!a.get_cancelErrorAlert()){alert("RadToolTipManager response error:\n Exception="+b);
}},saveClientState:function(){var a={AjaxTargetControl:this._ajaxControlID,Value:this._ajaxValue};
return Sys.Serialization.JavaScriptSerializer.serialize(a);
},_getUpdatePanelID:function(){return this.get_id()+"RTMPanel";
},_getUniqueToolTipID:function(){this._idCounter++;
return(this.get_id()+this._idCounter+(new Date()-100));
},_moveUpdatePanel:function(c,a){if(!c){c=this._updatePanelParent;
}if(c&&c.appendChild){var b=this.get_updatePanel();
if(b){if(false!=a){b.style.display="none";
}c.appendChild(b);
}return b;
}},set_modal:function(a){if(this._modal!=a){this._modal=a;
}},get_webServiceLoader:function(){return this._webServiceLoader;
},get_webServiceSettings:function(){return this._webServiceSettings;
},set_webServiceSettings:function(a){var b=Sys.Serialization.JavaScriptSerializer.deserialize(a);
this._webServiceSettings=new Telerik.Web.UI.WebServiceSettings(b);
},get_autoTooltipify:function(){return this._autoTooltipify;
},set_autoTooltipify:function(a){if(this._autoTooltipify!=a){this._autoTooltipify=a;
}},get_toolTipZoneID:function(){return this._toolTipZoneID;
},set_toolTipZoneID:function(a){if(this._toolTipZoneID!=a){this._toolTipZoneID=a;
}},get_isToolTipFactory:function(){return this._isToolTipFactory;
},set_isToolTipFactory:function(a){if(this._isToolTipFactory!=a){this._isToolTipFactory=a;
}},get_loadOnDemand:function(){return this._loadOnDemand;
},set_loadOnDemand:function(a){if(this._loadOnDemand!=a){this._loadOnDemand=a;
}},get_targetControls:function(){return this._targetControls;
},set_targetControls:function(a){if(!a){this._targetControls=[];
}else{this._targetControls=eval(a);
}},add_requestEnd:function(a){this.get_events().addHandler("requestEnd",a);
},remove_requestEnd:function(a){this.get_events().removeHandler("requestEnd",a);
},add_responseError:function(a){this.get_events().addHandler("responseError",a);
},remove_responseError:function(a){this.get_events().removeHandler("responseError",a);
}};
Telerik.Web.UI.RadToolTipManager.registerClass("Telerik.Web.UI.RadToolTipManager",Telerik.Web.UI.RadToolTip);
Telerik.Web.UI.RadToolTipManagerErrorEventArgs=function(a){Telerik.Web.UI.RadToolTipManagerErrorEventArgs.initializeBase(this);
this._cancelErrorAlert=false;
this._errorMessage=a;
};
Telerik.Web.UI.RadToolTipManagerErrorEventArgs.prototype={get_errorMessage:function(){return this._errorMessage;
},get_cancelErrorAlert:function(){return this._cancelErrorAlert;
},set_cancelErrorAlert:function(a){this._cancelErrorAlert=a;
}};
Telerik.Web.UI.RadToolTipManagerErrorEventArgs.registerClass("Telerik.Web.UI.RadToolTipManagerErrorEventArgs",Sys.EventArgs);
